package at.tasat.solver.queue;

import java.util.Random;

import at.tasat.solver.Queue;

public final class RandomQueue extends Queue {

	private final Random random;

	public RandomQueue(int numVariables, Random random) {
		super(numVariables);
		this.random = random;
	}

	@Override
	protected int getIndexForEnqueue(int variableId) {
		return getRandomIndex();
	}

	@Override
	protected int getIndexForReenqueue(int variableId) {
		return getRandomIndex();
	}

	private int getRandomIndex() {
		return random.nextInt(size() + 1);
	}
}
